using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SPSAndong.Entity;
using SPSAndong.Model;
using Leeder.Service;
using Leeder.Repository;
using SqlSugar;

namespace SPSAndong.Service
{
    /// <summary>
    /// SPS_MusicSet
    ///区域音乐设置
    /// </summary>
   public class MusicSetService : BaseService<MusicSetModel>
   {
        /// <summary>
        /// 关联实体类型
        /// </summary>
        protected override Type RefEntityType { get { return typeof(MusicSetEntity); } }

        public List<VoiceAreaMusicModel> GetMusicBroadcastSet()
        {
            return RF<BroadcastSetEntity, MusicSetEntity>.Queryable((g, t) => new JoinQueryInfos(JoinType.Left, g.AreaType == t.AreaType))
            .Select((g, t) => new VoiceAreaMusicModel
            {
                ID = g.ID,
                IPAddress = g.IPAddress,
                BroadcastState = g.BroadcastState,
                AreaType = t.AreaType,
                AreaName = t.AreaName,
                IsPlayAlong = t.IsPlayAlong,
                MusicId = t.MusicId,
                MusicState = t.MusicState,
                PlayTimes = t.PlayTimes,
                BroadcastVolume = g.BroadcastVolume
            }).ToList();
        }
    }
}